home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / libg_261.zip / libg_261 / libiberty / Makefile.in < prev    next >
Makefile  |  1994-10-11  |  8KB  |  281 lines

  1. #
  2. # Makefile
  3. #   Copyright (C) 1990, 1991, 1992 Free Software Foundation
  4. #
  5. # This file is part of the libiberty library.
  6. # Libiberty is free software; you can redistribute it and/or
  7. # modify it under the terms of the GNU Library General Public
  8. # License as published by the Free Software Foundation; either
  9. # version 2 of the License, or (at your option) any later version.
  10. #
  11. # Libiberty is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14. # Library General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU Library General Public
  17. # License along with libiberty; see the file COPYING.LIB.  If
  18. # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  19. # Cambridge, MA 02139, USA.
  20. #
  21.  
  22. # This file was written, and is maintained by K. Richard Pixley
  23. # <rich@cygnus.com>.
  24.  
  25. #
  26. # Makefile for libiberty directory
  27. #
  28.  
  29. srcdir = .
  30.  
  31. prefix = /usr/local
  32.  
  33. exec_prefix = $(prefix)
  34. bindir = $(exec_prefix)/bin
  35. libdir = $(exec_prefix)/lib
  36.  
  37. datadir = $(prefix)/lib
  38.  
  39. mandir = $(prefix)/man
  40. man1dir = $(mandir)/man1
  41. man2dir = $(mandir)/man2
  42. man3dir = $(mandir)/man3
  43. man4dir = $(mandir)/man4
  44. man5dir = $(mandir)/man5
  45. man6dir = $(mandir)/man6
  46. man7dir = $(mandir)/man7
  47. man8dir = $(mandir)/man8
  48. man9dir = $(mandir)/man9
  49. infodir = $(prefix)/info
  50. includedir = $(prefix)/include
  51. oldincludedir =
  52. docdir = $(datadir)/doc
  53.  
  54. SHELL = /bin/sh
  55.  
  56. INSTALL = install -c
  57. INSTALL_PROGRAM = $(INSTALL)
  58. INSTALL_DATA = $(INSTALL)
  59.  
  60. AR = ar
  61. AR_FLAGS = rc
  62.  
  63. ERRORS_CC = $(CC)
  64. CFLAGS = -g
  65. BISON = bison
  66. MAKEINFO = makeinfo
  67. RANLIB = ranlib
  68.  
  69. MAKEOVERRIDES =
  70.  
  71. TARGETLIB = libiberty.a
  72.  
  73. CONFIG_H = lconfig.h
  74. NEEDED_LIST = lneeded-list
  75.  
  76. # HOST_OFILES contains the list of objects that should be in the
  77. # library (in addition to the REQUIRED_OFILES and EXTRA_OFILES).
  78. # A configuration may override this with a fixed list a object files
  79. # names (hard to maintain), or some other way to generate a list.
  80. HOST_OFILES=`cat needed-list`
  81.  
  82. # Extra targets that the top-level target depends on.
  83. # Specifically, what needs to be made before HOST_OFILES can be used.
  84. # Can be empty if HOST_OFILES is just a list of file names.
  85. DO_ALSO = needed-list
  86.  
  87. # A configuration can specify extra .o files that should be included,
  88. # even if they are in libc. (Perhaps the libc version is buggy.)
  89. EXTRA_OFILES = 
  90.  
  91. # Flags to pass to a recursive make.  This is also used by xiberty.
  92. FLAGS_TO_PASS = \
  93.     "AR=$(AR)" \
  94.     "AR_FLAGS=$(AR_FLAGS)" \
  95.     "CC=$(CC)" \
  96.     "CFLAGS=$(CFLAGS)" \
  97.     "EXTRA_OFILES=$(EXTRA_OFILES)" \
  98.     "HDEFINES=$(HDEFINES)" \
  99.     "INCDIR=$(INCDIR)" \
  100.     "LDFLAGS=$(LDFLAGS)" \
  101.     "LOADLIBES=$(LOADLIBES)" \
  102.     "RANLIB=$(RANLIB)" \
  103.     "SHELL=$(SHELL)"
  104.  
  105. all:    $(TARGETLIB)
  106. .PHONY: check installcheck
  107. check installcheck:
  108.  
  109.  
  110. #### Host, target, and site specific Makefile fragments come in here.
  111. ###
  112.  
  113. INCDIR=$(srcdir)/../include
  114.  
  115. .c.o:
  116.     $(CC) -c $(CFLAGS) -I. -I$(INCDIR) $(HDEFINES) $<
  117.  
  118. # The default target just invokes make recursively.
  119. # However, the automatic configuration (in config/mh_default).
  120. # first causes it to figure out the objects missing in libc.
  121. info install-info clean-info dvi:
  122.  
  123. # NOTE: If you add new files to the library, add them to this list
  124. # (alphabetical), and add them to REQUIRED_OFILES or 'functions.def'.
  125. CFILES = alloca.c argv.c basename.c bcmp.c bcopy.c bzero.c \
  126.      clock.c concat.c cplus-dem.c fdmatch.c \
  127.      getcwd.c getopt.c getopt1.c getpagesize.c getruntime.c \
  128.          floatformat.c index.c insque.c \
  129.      memchr.c memcmp.c memcpy.c memmove.c memset.c \
  130.          obstack.c random.c rename.c rindex.c sigsetmask.c spaces.c \
  131.      strcasecmp.c strncasecmp.c \
  132.          strchr.c strdup.c strerror.c strrchr.c strsignal.c \
  133.          strstr.c strtod.c strtol.c strtoul.c tmpnam.c \
  134.      vasprintf.c vfork.c vfprintf.c vprintf.c vsprintf.c waitpid.c \
  135.      xatexit.c xexit.c xmalloc.c
  136. # These are always included in the library.
  137. REQUIRED_OFILES = argv.o basename.o concat.o cplus-dem.o fdmatch.o \
  138.   getopt.o getopt1.o getruntime.o \
  139.   floatformat.o obstack.o spaces.o strerror.o strsignal.o \
  140.   vasprintf.o xatexit.o xexit.o xmalloc.o 
  141.  
  142. # Do we want/need any config overrides?
  143. #     
  144.  
  145. STAGESTUFF = $(TARGETLIB) *.o
  146.  
  147. INSTALL_DEST = libdir
  148. install: install_to_$(INSTALL_DEST)
  149.  
  150. install_to_libdir: all
  151.     $(INSTALL_DATA) $(TARGETLIB) $(libdir)/$(TARGETLIB).n
  152.     ( cd $(libdir) ; $(RANLIB) $(libdir)/$(TARGETLIB).n )
  153.     mv -f $(libdir)/$(TARGETLIB).n $(libdir)/$(TARGETLIB)
  154.  
  155. install_to_tooldir: all
  156.     $(INSTALL_DATA) $(TARGETLIB) $(tooldir)/lib/$(TARGETLIB).n
  157.     ( cd $(tooldir) ; $(RANLIB) $(tooldir)/lib/$(TARGETLIB).n )
  158.     mv -f $(tooldir)/lib/$(TARGETLIB).n $(tooldir)/lib/$(TARGETLIB)
  159.  
  160. # The default configuration adds to libiberty all those functions that are
  161. # missing in libc.  More precisely, it includes whatever $(CC) fails to find.
  162. # Then a sed+awk combination translates the ld error messages into
  163. # a list of .o files.
  164.  
  165. needed-list: $(NEEDED_LIST)
  166.     cp $(NEEDED_LIST) needed-list
  167.  
  168. lneeded-list: $(EXTRA_OFILES) needed.awk errors
  169.     rm -f lneeded-list
  170.     f=""; \
  171.     for i in `awk -f needed.awk <errors` $(EXTRA_OFILES) ; do \
  172.       case " $$f " in \
  173.         *" $$i "*) ;; \
  174.         *) f="$$f $$i" ;; \
  175.       esac ; \
  176.     done ; \
  177.     echo $$f >>lneeded-list
  178.  
  179. # Generate an awk script that looks for functions in functions.def
  180.  
  181. needed.awk: $(srcdir)/functions.def Makefile
  182.     echo "# !Automatically generated from $(srcdir)/functions.def"\
  183.       "- DO NOT EDIT!" >needed.awk
  184.     grep '^DEF(' < $(srcdir)/functions.def \
  185.         | sed -e '/DEF/s|DEF.\([^,]*\).*|/\1/ { printf "\1.o " }|' \
  186.         >>needed.awk
  187.  
  188. config.h: $(CONFIG_H)
  189.     cp $(CONFIG_H) config.h
  190.  
  191. lconfig.h: needed2.awk errors
  192.     echo "/* !Automatically generated from $(srcdir)/functions.def"\
  193.       "- DO NOT EDIT! */" >lconfig.h
  194.     awk -f needed2.awk <errors >>lconfig.h
  195.  
  196. # Generate an awk script that looks for variables in functions.def
  197.  
  198. needed2.awk: $(srcdir)/functions.def Makefile
  199.     echo "# !Automatically generated from $(srcdir)/functions.def"\
  200.       "- DO NOT EDIT!" >needed2.awk
  201.     grep '^DEFVAR(' < $(srcdir)/functions.def \
  202.      | sed -e '/DEFVAR/s|DEFVAR.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
  203.      >>needed2.awk
  204.     grep '^DEFFUNC(' < $(srcdir)/functions.def \
  205.      | sed -e '/DEFFUNC/s|DEFFUNC.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
  206.      >>needed2.awk
  207.  
  208. dummy.o: $(srcdir)/dummy.c $(srcdir)/functions.def
  209.     $(CC) -c $(CFLAGS) -I. -I$(INCDIR) $(HDEFINES) $(srcdir)/dummy.c 2>/dev/null
  210.  
  211. errors: dummy.o $(EXTRA_OFILES)
  212.     -($(ERRORS_CC) -o dummy $(CFLAGS) $(LDFLAGS) $(ERRORS_LDFLAGS) dummy.o $(EXTRA_OFILES) $(LOADLIBES)) >errors 2>&1 || true
  213.  
  214. $(HOST_OFILES) $(REQUIRED_OFILES) : config.h
  215.  
  216. RULE1 = $(TARGETLIB)
  217. $(RULE1): $(REQUIRED_OFILES) $(DO_ALSO) .always.
  218.     @$(MAKE) RULE1=not-used RULE2=$(TARGETLIB) $(FLAGS_TO_PASS) \
  219.         "HOST_OFILES=$(HOST_OFILES)"
  220.  
  221. # Rule invoked by recursive make in $(RULE1).
  222. RULE2 = not-used
  223. $(RULE2): $(REQUIRED_OFILES) $(HOST_OFILES)
  224.     rm -rf $(TARGETLIB)
  225.     $(AR) $(AR_FLAGS) $(TARGETLIB) \
  226.       $(REQUIRED_OFILES) $(HOST_OFILES)
  227.     $(RANLIB) $(TARGETLIB)
  228.  
  229. .always.:
  230. # Do nothing.
  231.  
  232. .PHONEY: all etags tags ls clean stage1 stage2 .always.
  233.  
  234. etags tags: TAGS
  235.  
  236. TAGS: $(CFILES) $(HFILES)
  237.     etags `for i in $(HFILES) $(CFILES); do echo $(srcdir)/$$i ; done`
  238.  
  239. # The standalone demangler (c++filt) has been moved to binutils.
  240. demangle:
  241.     @echo "The standalone demangler, now named c++filt, is now"
  242.     @echo "a part of binutils."
  243.     @false
  244.  
  245. ls:
  246.     @echo Makefile $(HFILES) $(CFILES)
  247.  
  248. # Need to deal with profiled libraries, too.
  249.  
  250. mostlyclean:
  251.     rm -f *.o core errs \#* *.E a.out
  252.     rm -f needed.awk needed2.awk errors dummy needed-list config.h
  253.     rm -f $(CONFIG_H) $(NEEDED_LIST)
  254. clean: mostlyclean
  255.     rm -f *.a
  256. distclean: clean
  257.     rm -f *~ Makefile config.status alloca-conf.h TAGS
  258. realclean: distclean
  259.  
  260. force:
  261.  
  262. Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
  263.     $(SHELL) ./config.status
  264.  
  265. argv.o: $(INCDIR)/libiberty.h
  266. basename.o: $(INCDIR)/libiberty.h
  267. concat.o: $(INCDIR)/libiberty.h
  268. cplus-dem.o: $(INCDIR)/demangle.h
  269. fdmatch.o: $(INCDIR)/libiberty.h
  270. getopt.o: $(INCDIR)/getopt.h
  271. getopt1.o: $(INCDIR)/getopt.h
  272. getruntime.o: $(INCDIR)/libiberty.h
  273. floatformat.o: $(INCDIR)/floatformat.h
  274. obstack.o: $(INCDIR)/obstack.h
  275. spaces.o: $(INCDIR)/libiberty.h
  276. strerror.o: $(INCDIR)/libiberty.h
  277. strsignal.o: $(INCDIR)/libiberty.h
  278. xatexit.o: $(INCDIR)/libiberty.h
  279. xexit.o: $(INCDIR)/libiberty.h
  280. xmalloc.o: $(INCDIR)/libiberty.h
  281.